Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I found the whole behavior about unsetting
DISPLAY
to disable GUI dialogs to be really confusing, since I can't think of any other Unix CLI programs that automatically pop up GUI dialogs this way. The lpf usage documents the behavior, but for some reason by brain looks to the top of the command synopsis/usage first when looking for how to change program behavior, and it took me way too long to see the note about unsettingDISPLAY
at the bottom of the usage string.This change uses the Bash
getopts
builtin to:-n
flag that automatically unsetsDISPLAY
-h
will show usage and exit (as is currently the case), but now the exit code in this situation will now 0.After parsing
-h
or-n
the getopts code will shift the arguments and fall through to the existing command parsing code. I also updated the man page and usage string.Note that this uses the
getopts
shell builtin, not the externalgetopt
command, so this change does not introduce any additional dependencies as it uses a feature already built into Bash itself. Maybe the lack ofgetopts
in lpf is an intentional style choice, so take this as you will, but I consider this to be more Unixy and intuitive.